<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <EnableDefaultItems>false</EnableDefaultItems>
    <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
    <GenerateResxSourceOmitGetResourceString>true</GenerateResxSourceOmitGetResourceString>
    <GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
    <EnsureRuntimePackageDependencies>false</EnsureRuntimePackageDependencies>
    <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>

    <!-- Force System.Private.CoreLib.dll into a special IL output directory -->
    <OutputPath>$(RuntimeBinDir)IL/</OutputPath>
    <Configurations>Debug;Release;Checked</Configurations>
    <Platforms>x64;x86;arm;armv6;arm64;riscv64;s390x;wasm;ppc64le</Platforms>

    <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
    <FeatureWasmManagedThreads Condition="'$(WasmEnableThreads)' == 'true'">true</FeatureWasmManagedThreads>
    <DefineConstants Condition="'$(FeatureWasmManagedThreads)' == 'true'">$(DefineConstants);FEATURE_WASM_MANAGED_THREADS</DefineConstants>
  </PropertyGroup>

  <!-- Note that various places in SPCL depend on this resource name i.e. TplEventSource -->
  <ItemGroup Label="Embedded Resources">
    <EmbeddedResource Include="$(LibrariesProjectRoot)\System.Private.CoreLib\src\Resources\Strings.resx">
      <GenerateSource>true</GenerateSource>
      <ClassName>System.SR</ClassName>
    </EmbeddedResource>
  </ItemGroup>

  <PropertyGroup>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <!-- This prevents the default MsBuild targets from referencing System.Core.dll -->
    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
    <!-- These prevent the default MsBuild targets from referencing System.dll and mscorlib.dll -->
    <ExcludeMscorlibFacade>true</ExcludeMscorlibFacade>
    <RuntimeMetadataVersion>v4.0.30319</RuntimeMetadataVersion>
    <!-- Override InformationalVersion during servicing as it's returned via public api. -->
    <InformationalVersion Condition="'$(PreReleaseVersionLabel)' == 'servicing'">$(ProductVersion)</InformationalVersion>
    <InformationalVersion Condition="'$(StabilizePackageVersion)' == 'true'">$(ProductVersion)</InformationalVersion>
    <!-- AD0001 : https://github.com/dotnet/runtime/issues/90356 -->
    <NoWarn>$(NoWarn),0419,0649,AD0001</NoWarn>
    <Nullable>enable</Nullable>

    <!-- Ignore all previous constants since SPCL is sensitive to what is defined and the Sdk adds some by default -->
    <DefineConstants>MONO;NETCOREAPP;SYSTEM_PRIVATE_CORELIB</DefineConstants>
    <DisableImplicitConfigurationDefines>true</DisableImplicitConfigurationDefines>

    <DocumentationFile>$(OutputPath)$(MSBuildProjectName).xml</DocumentationFile>
  </PropertyGroup>

  <!-- Platform specific properties -->
  <PropertyGroup Condition="'$(Platform)' == 'x64'">
    <PlatformTarget>x64</PlatformTarget>
    <Prefer32Bit>false</Prefer32Bit>
    <DefineConstants>$(DefineConstants);TARGET_AMD64</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Platform)' == 'x86'">
    <PlatformTarget>x86</PlatformTarget>
    <DefineConstants>$(DefineConstants);TARGET_X86</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Platform)' == 'armv6'">
    <PlatformTarget>arm</PlatformTarget>
    <DefineConstants>$(DefineConstants);TARGET_ARMV6</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Platform)' == 'arm'">
    <PlatformTarget>arm</PlatformTarget>
    <DefineConstants>$(DefineConstants);TARGET_ARM</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Platform)' == 'arm64'">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DefineConstants>$(DefineConstants);TARGET_ARM64</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Platform)' == 'riscv64'">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DefineConstants>$(DefineConstants);TARGET_RISCV64</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Platform)' == 's390x'">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DefineConstants>$(DefineConstants);TARGET_S390X</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Platform)' == 'wasm'">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DefineConstants>$(DefineConstants);TARGET_WASM</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Platform)' == 'ppc64le'">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DefineConstants>$(DefineConstants);TARGET_POWERPC64</DefineConstants>
  </PropertyGroup>

  <!-- Configuration specific properties -->
  <PropertyGroup Condition="'$(Configuration)' == 'Debug' or '$(Configuration)' == 'Checked'">
    <Optimize Condition="'$(Optimize)' == '' and '$(Configuration)' == 'Debug'">false</Optimize>
    <Optimize Condition="'$(Optimize)' == '' and '$(Configuration)' == 'Checked'">true</Optimize>
    <DefineConstants>$(DefineConstants);_LOGGING;DEBUG</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
  </PropertyGroup>

  <!-- Assembly attributes -->
  <PropertyGroup>
    <Description>$(AssemblyName)</Description>
  </PropertyGroup>

  <!-- Signing -->
  <PropertyGroup>
    <StrongNameKeyId>SilverlightPlatform</StrongNameKeyId>
  </PropertyGroup>

  <!--
    Helper Paths
  -->
  <PropertyGroup>
    <CommonPath>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'Common', 'src'))</CommonPath>
    <BclSourcesRoot>$(MSBuildThisFileDirectory)src</BclSourcesRoot>
  </PropertyGroup>

  <!-- Compilation options -->

  <!-- Mono specific build changes -->
  <PropertyGroup>
    <NoWarn>$(NoWarn),618,67</NoWarn>

    <DefineConstants>$(DefineConstants);MONO_FEATURE_SRE</DefineConstants>

    <FeatureMono>true</FeatureMono>
    <FeatureWasmManagedThreads Condition="('$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true') and '$(WasmEnableThreads)' == 'true'">true</FeatureWasmManagedThreads>
    <FeatureWasmPerfTracing Condition="('$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true') and ('$(WasmEnableThreads)' == 'true')">true</FeatureWasmPerfTracing>
    <FeaturePortableTimer Condition="('$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true') or '$(FeatureWasmManagedThreads)' == 'true'">true</FeaturePortableTimer>
    <FeaturePortableThreadPool Condition="('$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true') or '$(FeatureWasmManagedThreads)' == 'true'">true</FeaturePortableThreadPool>
    <FeaturePerfTracing Condition="('$(TargetsBrowser)' != 'true' and '$(TargetsWasi)' != 'true') or '$(FeatureWasmPerftracing)' == 'true'">true</FeaturePerfTracing>
    <FeatureObjCMarshal Condition="'$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'">true</FeatureObjCMarshal>
  </PropertyGroup>

  <PropertyGroup>
    <DefineConstants Condition="'$(FeaturePerfTracing)' == 'true'">$(DefineConstants);FEATURE_PERFTRACING</DefineConstants>
    <DefineConstants Condition="'$(FeatureObjCMarshal)' == 'true'">$(DefineConstants);FEATURE_OBJCMARSHAL</DefineConstants>
    <DefineConstants Condition="'$(FeatureWasmManagedThreads)' == 'true'">$(DefineConstants);FEATURE_WASM_MANAGED_THREADS</DefineConstants>
    <DefineConstants Condition="'$(FeatureWasmPerfTracing)' == 'true'">$(DefineConstants);FEATURE_WASM_PERFTRACING</DefineConstants>
  </PropertyGroup>

  <!-- ILLinker settings -->
  <PropertyGroup>
    <ILLinkTrimAssembly>true</ILLinkTrimAssembly>
    <ILLinkDirectory>$(MSBuildThisFileDirectory)src\ILLink\</ILLinkDirectory>
  </PropertyGroup>

  <ItemGroup>
    <ILLinkDescriptorsXmls Include="$(ILLinkDirectory)ILLink.Descriptors.xml" />
    <ILLinkDescriptorsXmls Include="$(ILLinkDirectory)ILLink.Descriptors.OSX.xml" Condition="'$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'" />
    <ILLinkDescriptorsXmls Include="$(CoreLibSharedDir)ILLink\ILLink.Descriptors.Shared.xml" />
    <ILLinkDescriptorsXmls Condition="'$(FeaturePerfTracing)' == 'true'" Include="$(CoreLibSharedDir)ILLink\ILLink.Descriptors.EventSource.xml" />

    <ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.$(Platform).xml" Condition="Exists('$(ILLinkDirectory)ILLink.Substitutions.$(Platform).xml')" />
    <ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.iOS.xml" Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'" />
    <ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.Intrinsics.x86.xml" />
    <ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.Intrinsics.Vectors.xml" />

    <ILLinkLinkAttributesXmls Include="$(ILLinkDirectory)ILLink.LinkAttributes.xml" />
    <ILLinkLinkAttributesXmls Include="$(ILLinkDirectory)ILLink.LinkAttributes.$(Platform).xml" Condition="Exists('$(ILLinkDirectory)ILLink.LinkAttributes.$(Platform).xml')" />
  </ItemGroup>

  <!-- Sources -->
  <ItemGroup>
      <Compile Include="$(BclSourcesRoot)\Mono\RuntimeHandles.cs" />
      <Compile Include="$(BclSourcesRoot)\System\ArgIterator.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Array.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Attribute.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Buffer.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Delegate.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Enum.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Environment.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Exception.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\GC.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Object.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Math.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\MathF.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\ModuleHandle.cs" />
      <Compile Include="$(BclSourcesRoot)\System\MulticastDelegate.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Nullable.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\RuntimeArgumentHandle.cs" />
      <Compile Include="$(BclSourcesRoot)\System\RuntimeFieldHandle.cs" />
      <Compile Include="$(BclSourcesRoot)\System\RuntimeMethodHandle.cs" />
      <Compile Include="$(BclSourcesRoot)\System\RuntimeType.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\RuntimeTypeHandle.cs" />
      <Compile Include="$(BclSourcesRoot)\System\String.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Type.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\TypeIdentifier.cs" />
      <Compile Include="$(BclSourcesRoot)\System\TypedReference.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\TypeLoadException.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\ValueType.cs" />
      <Compile Include="$(BclSourcesRoot)\System\__ComObject.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Collections\Generic\ArraySortHelper.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Collections\Generic\Comparer.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Collections\Generic\EqualityComparer.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debugger.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Diagnostics\StackFrame.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Diagnostics\StackTrace.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Tracing\EventPipe.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Tracing\NativeRuntimeEventSource.Threading.NativeSinks.Mono.cs" Condition="'$(FeaturePerfTracing)' == 'true'" />
      <Compile Include="$(BclSourcesRoot)\System\IO\FileLoadException.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Assembly.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyName.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\ConstructorInvoker.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\CustomAttribute.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\FieldInfo.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\LoaderAllocator.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\MemberInfo.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\MethodBase.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\MethodBaseInvoker.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\MethodInvoker.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\ModifiedType.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeAssembly.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeCustomAttributeData.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeEventInfo.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeFieldInfo.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeLocalVariableInfo.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeMethodBody.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeMethodInfo.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeModule.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeParameterInfo.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimePropertyInfo.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeExceptionHandlingClause.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\ConstructorOnTypeBuilderInstantiation.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\CustomAttributeBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\DynamicILInfo.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\DynamicMethod.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\FieldOnTypeBuilderInstantiation.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\MethodOnTypeBuilderInstantiation.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\MonoArrayMethod.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeAssemblyBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeConstructorBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeEnumBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeEventBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeFieldBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeGenericTypeParameterBuilder.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeILGenerator.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeLocalBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeMethodBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeModuleBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeParameterBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimePropertyBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\RuntimeTypeBuilder.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\SignatureHelper.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\SymbolType.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\TypeBuilderInstantiation.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\UnmanagedMarshal.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Metadata\AssemblyExtensions.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\Metadata\MetadataUpdater.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Reflection\TypeNameParser.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\ControlledExecution.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\DependentHandle.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\GCFrameRegistration.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\GCSettings.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\JitInfo.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\JitHelpers.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeHelpers.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\GCHandle.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\Marshal.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\MemoryMarshal.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\MarshalAsAttribute.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\NativeLibrary.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\SafeHandle.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\ObjectiveCMarshal.Mono.cs"
               Condition="'$(FeatureObjCMarshal)' == 'true'"/>
      <Compile Include="$(BclSourcesRoot)\System\Runtime\Intrinsics\X86\X86Base.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Runtime\Loader\AssemblyLoadContext.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\Interlocked.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\Monitor.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\ObjectHeader.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\Thread.Mono.cs" />
      <Compile Include="$(CommonPath)System\Collections\Generic\ArrayBuilder.cs">
        <Link>CommonSystem\Collections\Generic\ArrayBuilder.cs</Link>
      </Compile>
  </ItemGroup>
  <ItemGroup Condition="('$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true') and '$(FeaturePortableThreadPool)' == 'true'">
      <Compile Include="$(BclSourcesRoot)\System\Threading\LowLevelLifoSemaphore.Unix.Mono.cs" />
  </ItemGroup>
  <ItemGroup Condition="'$(TargetsBrowser)' == 'true' and '$(FeatureWasmManagedThreads)' == 'true'">
      <Compile Include="$(BclSourcesRoot)\System\Threading\ThreadPoolBoundHandle.Browser.Threads.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\PortableThreadPool.Browser.Threads.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\ThreadPool.Browser.Threads.Mono.cs" />
  </ItemGroup>
  <ItemGroup Condition="'$(TargetsBrowser)' == 'true' and '$(FeatureWasmManagedThreads)' != 'true'">
      <Compile Include="$(BclSourcesRoot)\System\Threading\ThreadPoolBoundHandle.Browser.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\PreAllocatedOverlapped.Browser.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\ThreadPool.Browser.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\TimerQueue.Browser.Mono.cs" />
  </ItemGroup>
  <ItemGroup Condition="'$(TargetsWasi)' == 'true'">
      <Compile Include="$(BclSourcesRoot)\System\Threading\ThreadPoolBoundHandle.Browser.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\PreAllocatedOverlapped.Browser.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\ThreadPool.Wasi.Mono.cs" />
      <Compile Include="$(BclSourcesRoot)\System\Threading\TimerQueue.Wasi.Mono.cs" />
  </ItemGroup>
  <ItemGroup>
      <Compile Include="$(BclSourcesRoot)\Mono\HotReload.cs" />
      <Compile Include="$(BclSourcesRoot)\Mono\RuntimeStructs.cs" />
      <Compile Include="$(BclSourcesRoot)\Mono\SafeStringMarshal.cs" />
      <Compile Include="$(BclSourcesRoot)\Mono\SafeGPtrArrayHandle.cs" />
      <Compile Include="$(BclSourcesRoot)\System\TypeSpec.cs" />
  </ItemGroup>

  <!-- Enable unsupported browser warnings -->
  <ItemGroup Condition="'$(TargetsBrowser)' == 'true' or '$(TargetsAnyOS)' == 'true'">
    <SupportedPlatform Include="browser"/>
  </ItemGroup>
  <ItemGroup Condition="'$(TargetsWasi)' == 'true' or '$(TargetsAnyOS)' == 'true'">
    <SupportedPlatform Include="wasi"/>
  </ItemGroup>

  <Import Project="$(LibrariesProjectRoot)\System.Private.CoreLib\src\System.Private.CoreLib.Shared.projitems" Label="Shared" />

  <ItemGroup>
    <ProjectReference Include="$(LibrariesProjectRoot)\System.Private.CoreLib\gen\System.Private.CoreLib.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
  </ItemGroup>

  <Target Name="CopyCoreLibToBinDir" AfterTargets="Build">
    <Copy SourceFiles="$(RuntimeBinDir)/IL/System.Private.CoreLib.dll;$(RuntimeBinDir)/IL/System.Private.CoreLib.pdb"
          DestinationFolder="$(RuntimeBinDir)"
          SkipUnchangedFiles="true" />
  </Target>

  <!-- Setup eventing file generation -->
  <ItemGroup>
    <EventingGenerationScript Include="$(CoreClrProjectRoot)scripts/genRuntimeEventSources.py" />
    <EventManifestFile Include="$(CoreClrProjectRoot)vm/ClrEtwAll.man" />
    <EventingSourceFile Include="$(IntermediateOutputPath)..\..\..\Eventing\$(TargetArchitecture)\$(Configuration)\NativeRuntimeEventSource.Mono.cs" Condition="'$(FeaturePerfTracing)' == 'true' ">
      <Link>src\System\Diagnostics\Eventing\Generated\NativeRuntimeEventSource.Mono.cs</Link>
    </EventingSourceFile>
    <Compile Include="@(EventingSourceFile)" />
  </ItemGroup>

  <Target Name="GenerateEventingFiles"
          Inputs="@(EventingGenerationScript);@(EventManifestFile)"
          Outputs="@(EventingSourceFile)"
          DependsOnTargets="FindPython"
          BeforeTargets="BeforeCompile">

    <Error Condition="'$(PYTHON)' == ''" Text="Unable to locate Python. NativeRuntimeEventSource.Mono.cs cannot be generated without Python installed on the machine. Either install Python in your path or point to it with the PYTHON environment variable." />
    <PropertyGroup>
      <_PythonWarningParameter>-Wall</_PythonWarningParameter>
      <_PythonWarningParameter Condition="'$(MSBuildTreatWarningsAsErrors)' == 'true'">$(_PythonWarningParameter) -Werror</_PythonWarningParameter>
      <_EventingSourceFileDirectory>%(EventingSourceFile.RootDir)%(EventingSourceFile.Directory)</_EventingSourceFileDirectory>
      <_EventingSourceFileDirectory Condition="HasTrailingSlash('$(_EventingSourceFileDirectory)')">$(_EventingSourceFileDirectory.TrimEnd('\'))</_EventingSourceFileDirectory>
    </PropertyGroup>

    <Exec Command="&quot;$(PYTHON)&quot; -B $(_PythonWarningParameter) &quot;@(EventingGenerationScript)&quot; --man &quot;@(EventManifestFile)&quot; --intermediate &quot;$(_EventingSourceFileDirectory)&quot; --runtimeflavor mono" />

    <ItemGroup>
      <FileWrites Include="@(EventingSourceFile)" />
    </ItemGroup>
  </Target>
</Project>
